home *** CD-ROM | disk | FTP | other *** search
/ Champak 141 / (Vol 141) Oct 17 2011.iso / Games / Clueless.swf / scripts / Forms / TitleForm.as < prev    next >
Encoding:
Text File  |  2011-10-17  |  4.7 KB  |  174 lines

  1. package Forms
  2. {
  3.    import flash.events.Event;
  4.    import flash.events.MouseEvent;
  5.    import flash.system.fscommand;
  6.    import flash.text.TextField;
  7.    
  8.    [Embed(source="/_assets/assets.swf", symbol="Forms.TitleForm")]
  9.    public class TitleForm extends CluelessBaseForm
  10.    {
  11.        
  12.       
  13.       public var _tfContinue:TextField;
  14.       
  15.       internal var bStartGame:Boolean = false;
  16.       
  17.       public var _bOptions:Button;
  18.       
  19.       protected var _aFilterEnabled:Array;
  20.       
  21.       protected var _aFilterDisabled:Array;
  22.       
  23.       public var _tfOptions:TextField;
  24.       
  25.       public var _bPlay:Button;
  26.       
  27.       internal var playintro:Boolean = true;
  28.       
  29.       public function TitleForm()
  30.       {
  31.          playintro = true;
  32.          bStartGame = false;
  33.          super();
  34.          Music = "MenuMusic";
  35.          localize(_tfContinue,"PLAY");
  36.          localize(_tfOptions,"OPTIONS");
  37.          this.getChildByName("_bPlay").addEventListener(MouseEvent.CLICK,onPlay,false,0,true);
  38.          this.getChildByName("_bOptions").addEventListener(MouseEvent.CLICK,onOptions,false,0,true);
  39.          _tfContinue.mouseEnabled = false;
  40.          installMouseOverSound(_bPlay);
  41.          installMouseOverSound(_bOptions);
  42.       }
  43.       
  44.       public static function getLevelForm(param1:String) : BaseForm
  45.       {
  46.          var _loc2_:DressupForm = null;
  47.          var _loc3_:DressupLevelInfo = null;
  48.          var _loc4_:CutsceneForm = null;
  49.          _loc2_ = new DressupForm();
  50.          _loc3_ = new DressupLevelInfo(param1);
  51.          _loc2_.init(_loc3_);
  52.          if(_loc3_.LevelCutscene != "")
  53.          {
  54.             (_loc4_ = new CutsceneForm()).init(_loc2_,_loc3_.LevelCutscene);
  55.             return _loc4_;
  56.          }
  57.          return _loc2_;
  58.       }
  59.       
  60.       override public function onUnfocus() : void
  61.       {
  62.          super.onUnfocus();
  63.       }
  64.       
  65.       protected function onOnline(param1:MouseEvent) : void
  66.       {
  67.          setForm(new SnapshotForm());
  68.       }
  69.       
  70.       protected function onHighScore(param1:MouseEvent) : void
  71.       {
  72.          setForm(new HighScoreForm());
  73.       }
  74.       
  75.       override public function onFocus() : void
  76.       {
  77.          super.onFocus();
  78.          if(Profile.ProfileList.length > 0)
  79.          {
  80.             Storage.getInstance().deleteProfile("Cher");
  81.          }
  82.          Storage.getInstance().createStartingProfile();
  83.          playintro = true;
  84.          if(Profile.CurrentProfile.Ending == 1)
  85.          {
  86.             Profile.CurrentProfile.Ending = 0;
  87.             setForm(new HighScoreForm());
  88.          }
  89.          if(bStartGame == true)
  90.          {
  91.             bStartGame = false;
  92.             StartGame();
  93.          }
  94.       }
  95.       
  96.       protected function StartGame() : void
  97.       {
  98.          var _loc1_:CutsceneForm = null;
  99.          Profile.CurrentProfile.TutorialMask = 0;
  100.          Profile.CurrentProfile.bTutorial = 0;
  101.          if(playintro == true)
  102.          {
  103.             _loc1_ = new CutsceneForm();
  104.             _loc1_.init(getLevelForm("Tutorial"),"MainIntro1");
  105.             setForm(_loc1_);
  106.          }
  107.          else
  108.          {
  109.             setForm(getLevelForm("Tutorial"));
  110.          }
  111.       }
  112.       
  113.       protected function OnHidePopup(param1:Event) : void
  114.       {
  115.       }
  116.       
  117.       protected function onChangeProfile(param1:Event) : void
  118.       {
  119.          setForm(new ProfileForm());
  120.       }
  121.       
  122.       protected function onExit(param1:MouseEvent) : void
  123.       {
  124.          fscommand("quit","");
  125.          MainDocument.forceQuit();
  126.       }
  127.       
  128.       protected function onPlay(param1:MouseEvent) : void
  129.       {
  130.          StartGame();
  131.       }
  132.       
  133.       protected function onCredits(param1:MouseEvent) : void
  134.       {
  135.          setForm(new CreditsForm());
  136.       }
  137.       
  138.       protected function onOptions(param1:MouseEvent) : void
  139.       {
  140.          setForm(new OptionsForm());
  141.       }
  142.       
  143.       protected function onNewGame(param1:MouseEvent) : void
  144.       {
  145.          if(Profile.ProfileList.length == 0)
  146.          {
  147.             bStartGame = true;
  148.             setForm(new ProfileCreatePopupForm(),true);
  149.          }
  150.          else
  151.          {
  152.             if(Profile.CurrentProfile.bRestartgame)
  153.             {
  154.                Profile.CurrentProfile.resetCurrentProfile();
  155.                Storage.getInstance().saveProfiles();
  156.                StartGame();
  157.             }
  158.             StartGame();
  159.          }
  160.       }
  161.       
  162.       protected function onCreateNew(param1:Event) : void
  163.       {
  164.          Profile.CurrentProfile.resetCurrentProfile();
  165.          Storage.getInstance().saveProfiles();
  166.          StartGame();
  167.       }
  168.       
  169.       protected function onMemory(param1:MouseEvent) : void
  170.       {
  171.       }
  172.    }
  173. }
  174.